<?php include W3TC_DIR . '/inc/options/common/header.phtml'; ?>

<p>
	The plugin is currently <span class="w3tc-<?php if ($enabled): ?>enabled">enabled<?php else: ?>disabled">disabled<?php endif; ?></span>. If an option is disabled it means that either your current installation is not compatible or software installation is required.
</p>

<form action="admin.php">
    <p>
    	Perform a
    	<input type="hidden" name="page" value="<?php echo $this->_page; ?>" />
    	<input type="button" class="button button-self-test" value="compatibility check" />,
    	<input class="button" type="submit" name="flush_all" value="empty all caches"<?php if (! $can_empty_memcache && ! $can_empty_opcode && ! $can_empty_file): ?> disabled="disabled"<?php endif; ?> /> at once or
    	<input class="button" type="submit" name="flush_memcached" value="empty only the memcached cache(s)"<?php if (! $can_empty_memcache): ?> disabled="disabled"<?php endif; ?> /> or
    	<input class="button" type="submit" name="flush_opcode" value="empty only the opcode cache"<?php if (! $can_empty_opcode): ?> disabled="disabled"<?php endif; ?> /> or
    	<input class="button" type="submit" name="flush_file" value="empty only the disk cache(s)"<?php if (! $can_empty_file): ?> disabled="disabled"<?php endif; ?> />.
    </p>
</form>

<form action="admin.php?page=<?php echo $this->_page; ?>" method="post">
    <fieldset>
    	<legend>General</legend>
    
        <table class="form-table">
        	<tr>
        		<th colspan="2">
                	<label>
                		<input id="enabled" type="checkbox" name="enabled" value="1"<?php checked($enabled_checked, true); ?> />
                		Deselect this option to disable all caching functionality.
                	</label>
        		</th>
        	</tr>
            <tr>
            	<th valign="top">Preview Mode:</th>
            	<td>
                	<?php if ($preview): ?>
                	<input type="hidden" name="preview" value="0" />
                	<input type="submit" name="preview_save" class="button-primary" value="Disable" />
                	<?php echo $this->button_link('Preview', w3_get_site_url() . '/?w3tc_preview=1', true); ?>
                	<?php echo $this->button_link('Deploy', sprintf('admin.php?page=%s&preview_deploy', $this->_page)); ?>
                	<?php else: ?>
                	<input type="hidden" name="preview" value="1" />
                	<input type="submit" name="preview_save" class="button-primary" value="Enable" />
                	<?php endif; ?>
					<br /><span class="description">Use preview mode to test configuration scenarios prior to releasing them (deploy) on the actual site.</span>
        		</td>
        	</tr>
		</table>        
        
        <p class="submit">
        	<input type="submit" name="options_save" class="button-primary" value="Save changes" />
        </p>
    </fieldset>
    
    <fieldset>
    	<legend><a href="admin.php?page=w3tc_pgcache">Page Cache</a></legend>

    	<p>Enable page caching to decrease the response time of your site.</p>

        <table class="form-table">
            <tr>
            	<th valign="top">Page Cache:</th>
            	<td>
            		<input type="hidden" name="pgcache.enabled" value="0" />
            		<label><input class="enabled" type="checkbox" name="pgcache.enabled" value="1"<?php checked($pgcache_enabled, true); ?> />&nbsp;<strong>Enable</strong></label>
            		<br /><span class="description">Caching pages will reduce the response time of your site and increase the scale of your web server.</span>
        		</td>
        	</tr>
        	<tr>
        		<th valign="top">Page Cache Method:</th>
        		<td>
        			<select name="pgcache.engine">
        				<optgroup label="Shared Server (disk enhanced is best):">
                			<option value="file_pgcache"<?php selected($this->_config->get_string('pgcache.engine'), 'file_pgcache'); ?>>Disk (enhanced)</option>
                			<option value="file"<?php selected($this->_config->get_string('pgcache.engine'), 'file'); ?>>Disk (basic)</option>
            			</optgroup>
            			<optgroup label="Dedicated / Virtual Server:">
    	    				<option value="apc"<?php selected($this->_config->get_string('pgcache.engine'), 'apc'); ?><?php if (! $check_apc): ?> disabled="disabled"<?php endif; ?>>Opcode: Alternative PHP Cache (APC)</option>
    	    				<option value="eaccelerator"<?php selected($this->_config->get_string('pgcache.engine'), 'eaccelerator'); ?><?php if (! $check_eaccelerator): ?> disabled="disabled"<?php endif; ?>>Opcode: eAccelerator</option>
    	    				<option value="xcache"<?php selected($this->_config->get_string('pgcache.engine'), 'xcache'); ?><?php if (! $check_xcache): ?> disabled="disabled"<?php endif; ?>>Opcode: XCache</option>
            			</optgroup>
    					<optgroup label="Multiple Servers:">
    	        			<option value="memcached"<?php selected($this->_config->get_string('pgcache.engine'), 'memcached'); ?><?php if (! $check_memcached): ?> disabled="disabled"<?php endif; ?>>Memcached</option>
            			</optgroup>
        			</select>
        		</td>
            </tr>
        </table>

        <p class="submit">
        	<input type="submit" name="options_save" class="button-primary" value="Save changes" />
        </p>
    </fieldset>

    <fieldset>
    	<legend>
        	<?php if (W3TC_PHP5): ?>
        	<a href="admin.php?page=w3tc_minify">Minify</a>
        	<?php else: ?>
        	Minify
        	<?php endif; ?>
    	</legend>

    	<p>Reduce load time by decreasing the size and number of <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym> files. Automatically remove unncessary data from <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym>, feed, page and post <acronym title="Hypertext Markup Language">HTML</acronym>.</p>

        <table class="form-table">
            <tr>
            	<th valign="top">Minify:</th>
            	<td>
            		<input type="hidden" name="minify.enabled" value="0"<?php if (! W3TC_PHP5): ?> disabled="disabled"<?php endif; ?> />
            		<label><input class="enabled" type="checkbox" name="minify.enabled" value="1"<?php checked($minify_enabled, true); ?><?php if (! W3TC_PHP5): ?> disabled="disabled"<?php endif; ?> />&nbsp;<strong>Enable</strong></label>
            		<br /><span class="description">Minification can decrease file size of <acronym title="Hypertext Markup Language">HTML</acronym>, <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym> and feeds respectively by ~10% on average.</span>
            	</td>
            </tr>
            <tr>
            	<th valign="top">Minify Cache Method:</th>
            	<td>
            		<select name="minify.engine"<?php if (! W3TC_PHP5): ?> disabled="disabled"<?php endif; ?>>
            			<optgroup label="Shared Server (disk is best):">
                			<option value="file"<?php selected($this->_config->get_string('minify.engine'), 'file'); ?>>Disk</option>
                		</optgroup>
                		<optgroup label="Dedicated / Virtual Server:">
    	    				<option value="apc"<?php selected($this->_config->get_string('minify.engine'), 'apc'); ?><?php if (! $check_apc): ?> disabled="disabled"<?php endif; ?>>Opcode: Alternative PHP Cache (APC)</option>
    	    				<option value="eaccelerator"<?php selected($this->_config->get_string('minify.engine'), 'eaccelerator'); ?><?php if (! $check_eaccelerator): ?> disabled="disabled"<?php endif; ?>>Opcode: eAccelerator</option>
    	    				<option value="xcache"<?php selected($this->_config->get_string('minify.engine'), 'xcache'); ?><?php if (! $check_xcache): ?> disabled="disabled"<?php endif; ?>>Opcode: XCache</option>
        				</optgroup>
                		<optgroup label="Multiple Servers:">
                			<option value="memcached"<?php selected($this->_config->get_string('minify.engine'), 'memcached'); ?><?php if (! $check_memcached): ?> disabled="disabled"<?php endif; ?>>Memcached</option>
                		</optgroup>
            		</select>
            	</td>
            </tr>
        </table>

        <p class="submit">
        	<input type="submit" name="options_save" class="button-primary" value="Save changes" />
        </p>
    </fieldset>

    <fieldset>
    	<legend><a href="admin.php?page=w3tc_dbcache">Database Cache</a></legend>

        <p>Enable database caching to reduce post, page and feed creation time.</p>

         <table class="form-table">
         	<tr>
         		<th valign="top">Database Cache:</th>
         		<td>
         			<input type="hidden" name="dbcache.enabled" value="0" />
        			<label><input class="enabled" type="checkbox" name="dbcache.enabled" value="1"<?php checked($dbcache_enabled, true); ?> />&nbsp;<strong>Enable</strong></label>
        			<br /><span class="description">Caching database objects decreases the response time of your site. Best used if object caching is not possible.</span>
        		</td>
        	</tr>
        	<tr>
        		<th valign="top">Database Cache Method:</th>
        		<td>
        			<select name="dbcache.engine">
            			<optgroup label="Shared Server:">
                			<option value="file"<?php selected($this->_config->get_string('dbcache.engine'), 'file'); ?>>Disk</option>
                		</optgroup>
                		<optgroup label="Dedicated / Virtual Server:">
    	    				<option value="apc"<?php selected($this->_config->get_string('dbcache.engine'), 'apc'); ?><?php if (! $check_apc): ?> disabled="disabled"<?php endif; ?>>Opcode: Alternative PHP Cache (APC)</option>
    	    				<option value="eaccelerator"<?php selected($this->_config->get_string('dbcache.engine'), 'eaccelerator'); ?><?php if (! $check_eaccelerator): ?> disabled="disabled"<?php endif; ?>>Opcode: eAccelerator</option>
    	    				<option value="xcache"<?php selected($this->_config->get_string('dbcache.engine'), 'xcache'); ?><?php if (! $check_xcache): ?> disabled="disabled"<?php endif; ?>>Opcode: XCache</option>
        				</optgroup>
                		<optgroup label="Multiple Servers:">
                			<option value="memcached"<?php selected($this->_config->get_string('dbcache.engine'), 'memcached'); ?><?php if (! $check_memcached): ?> disabled="disabled"<?php endif; ?>>Memcached</option>
                		</optgroup>
        			</select>
        		</td>
        	</tr>
        </table>

        <p class="submit">
        	<input type="submit" name="options_save" class="button-primary" value="Save changes" />
        </p>
	</fieldset>
    
    
    <fieldset>
    	<legend><a href="admin.php?page=w3tc_objectcache">Object Cache</a></legend>

        <p>Enable object caching to further reduce execution time for common operations.</p>

         <table class="form-table">
         	<tr>
         		<th valign="top">Object Cache:</th>
         		<td>
         			<input type="hidden" name="objectcache.enabled" value="0" />
        			<label><input class="enabled" type="checkbox" name="objectcache.enabled" value="1"<?php checked($objectcache_enabled, true); ?> />&nbsp;<strong>Enable</strong></label>
        			<br /><span class="description">Object caching greatly increases performance for highly dynamic sites (that use the Object Cache <acronym title="Application Programming Interface">API</acronym>).</span>
        		</td>
        	</tr>
        	<tr>
        		<th valign="top">Object Cache Method:</th>
        		<td>
        			<select name="objectcache.engine">
            			<optgroup label="Shared Server:">
                			<option value="file"<?php selected($this->_config->get_string('objectcache.engine'), 'file'); ?>>Disk</option>
                		</optgroup>
                		<optgroup label="Dedicated / Virtual Server:">
    	    				<option value="apc"<?php selected($this->_config->get_string('objectcache.engine'), 'apc'); ?><?php if (! $check_apc): ?> disabled="disabled"<?php endif; ?>>Opcode: Alternative PHP Cache (APC)</option>
    	    				<option value="eaccelerator"<?php selected($this->_config->get_string('objectcache.engine'), 'eaccelerator'); ?><?php if (! $check_eaccelerator): ?> disabled="disabled"<?php endif; ?>>Opcode: eAccelerator</option>
    	    				<option value="xcache"<?php selected($this->_config->get_string('objectcache.engine'), 'xcache'); ?><?php if (! $check_xcache): ?> disabled="disabled"<?php endif; ?>>Opcode: XCache</option>
        				</optgroup>
                		<optgroup label="Multiple Servers:">
                			<option value="memcached"<?php selected($this->_config->get_string('objectcache.engine'), 'memcached'); ?><?php if (! $check_memcached): ?> disabled="disabled"<?php endif; ?>>Memcached</option>
                		</optgroup>
        			</select>
        		</td>
        	</tr>
        </table>

        <p class="submit">
        	<input type="submit" name="options_save" class="button-primary" value="Save changes" />
        </p>
	</fieldset>

    <fieldset>
    	<legend><a href="admin.php?page=w3tc_cdn">Content Delivery Network</a></legend>

        <p>Host static files with your content delivery network provider to reduce page load time.</p>

        <table class="form-table">
            <tr>
    			<th><acronym title="Content Delivery Network">CDN</acronym>:</th>
            	<td>
            		<input type="hidden" name="cdn.enabled" value="0" />
    				<label><input class="enabled" type="checkbox" name="cdn.enabled" value="1"<?php checked($cdn_enabled, true); ?> />&nbsp;<strong>Enable</strong></label>
    				<br /><span class="description">Theme files, media library attachments, <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym> files etc will appear to load instantly for site visitors.</span>
            	</td>
            </tr>
            <tr>
    			<th><acronym title="Content Delivery Network">CDN</acronym> Type:</th>
            	<td>
            		<select name="cdn.engine">
            			<optgroup label="Origin Pull (mirror is best):">
							<option value="mirror"<?php selected($this->_config->get_string('cdn.engine'), 'mirror'); ?>>Mirror</option>
                            <option value="netdna"<?php selected($this->_config->get_string('cdn.engine'), 'netdna'); ?>>Mirror: NetDNA / MaxCDN</option>
                		</optgroup>
            			<optgroup label="Origin Push:">
							<option value="rscf"<?php selected($this->_config->get_string('cdn.engine'), 'rscf'); ?><?php if (! W3TC_PHP5 || ! $check_curl): ?> disabled="disabled"<?php endif; ?>>Rackspace Cloud Files</option>
							<option value="cf"<?php selected($this->_config->get_string('cdn.engine'), 'cf'); ?><?php if (! W3TC_PHP5 || ! $check_curl): ?> disabled="disabled"<?php endif; ?>>Amazon CloudFront</option>
							<option value="s3"<?php selected($this->_config->get_string('cdn.engine'), 's3'); ?><?php if (! W3TC_PHP5 || ! $check_curl): ?> disabled="disabled"<?php endif; ?>>Amazon Simple Storage Service (S3)</option>
							<option value="ftp"<?php selected($this->_config->get_string('cdn.engine'), 'ftp'); ?><?php if (! $check_ftp): ?> disabled="disabled"<?php endif; ?>>Self-hosted / File Transfer Protocol Upload</option>
                		</optgroup>
            		</select><br />
            		<span class="description">Select the <acronym title="Content Delivery Network">CDN</acronym> type you wish to use.</span>
            	</td>
            </tr>
        </table>

        <p class="submit">
        	<input type="submit" name="options_save" class="button-primary" value="Save changes" />
        </p>
	</fieldset>

    <fieldset>
    	<legend><a href="admin.php?page=w3tc_browsercache">Browser Cache</a></legend>

        <p>Reduce server load and decrease response time by using the cache available in site visitor's web browser.</p>

        <table class="form-table">
         	<tr>
         		<th valign="top">Browser Cache:</th>
         		<td>
         			<input type="hidden" name="browsercache.enabled" value="0" />
        			<label><input class="enabled" type="checkbox" name="browsercache.enabled" value="1"<?php checked($browsercache_enabled, true); ?> />&nbsp;<strong>Enable</strong></label>
        			<br /><span class="description">Enable <acronym title="Hypertext Transfer Protocol">HTTP</acronym> compression and add headers to reduce server load and decrease file load time.</span>
        		</td>
        	</tr>
        </table>

        <p class="submit">
        	<input type="submit" name="options_save" class="button-primary" value="Save changes" />
        </p>
	</fieldset>
    
    <fieldset>
    	<legend>Support Us</legend>

    	<p>We're working to make WordPress better. Please support us, here's how:</p>

    	<p>
        	<label>Link to us in your 
            	<select name="common.support">
            		<option value="">select one</option>
            		<?php foreach ($supports as $support_id => $support_name): ?>
            		<option value="<?php echo $support_id; ?>"<?php selected($support, $support_id); ?>><?php echo htmlspecialchars($support_name); ?></option>
            		<?php endforeach; ?>
            	</select>
            </label>, tell your friends with a <input type="button" class="button button-tweet" value="tweet" /> and give us a perfect <input type="button" class="button button-rating" value="rating" />.
    	</p>

        <p>If you want to manually place a link, here is the code:</p>
        <p><textarea cols="80" rows="4">Performance Optimization &lt;a href=&quot;http://www.w3-edge.com/wordpress-plugins/&quot; rel=&quot;external&quot;&gt;WordPress Plugins&lt;/a&gt; by W3 EDGE</textarea></p>

        <p class="submit">
        	<input type="submit" name="options_save" class="button-primary" value="Save changes" />
        </p>
	</fieldset>

    <fieldset>
    	<legend>Debug</legend>

        <p>Detailed information about each cache will be appended in (publicly available) <acronym title="Hypertext Markup Language">HTML</acronym> comments in the page's source code. Performance in this mode will not be optimal, use sparingly and disable when not in use.</p>

        <table class="form-table">
         	<tr>
         		<th valign="top">Debug Mode:</th>
         		<td>
         			<label><input type="checkbox" name="debug[]" value="pgcache"<?php checked($this->_config->get_boolean('pgcache.debug'), true); ?> /> Page Cache</label><br />
         			<label><input type="checkbox" name="debug[]" value="minify"<?php checked($this->_config->get_boolean('minify.debug'), true); ?> /> Minify</label><br />
         			<label><input type="checkbox" name="debug[]" value="dbcache"<?php checked($this->_config->get_boolean('dbcache.debug'), true); ?> /> Database Cache</label><br />
                    <label><input type="checkbox" name="debug[]" value="objectcache"<?php checked($this->_config->get_boolean('objectcache.debug'), true); ?> /> Object Cache</label><br />
         			<label><input type="checkbox" name="debug[]" value="cdn"<?php checked($this->_config->get_boolean('cdn.debug'), true); ?> /> Content Delivery Network</label><br />
            		<span class="description">If selected, detailed caching information will be appear at the end of each page in a <acronym title="Hypertext Markup Language">HTML</acronym> comment. View a page's source code to review.</span>
        		</td>
        	</tr>
        </table>

        <p class="submit">
        	<input type="submit" name="options_save" class="button-primary" value="Save changes" />
        </p>
	</fieldset>

    <fieldset>
    	<legend>Miscellaneous</legend>

    	<p>
    		<input type="hidden" name="widget.latest.enabled" value="0" />
    		<label><input type="checkbox" name="widget.latest.enabled" value="1"<?php checked($this->_config->get_boolean('widget.latest.enabled'), true); ?> /> Enable dashboard news widget</label>
			<br /><span class="description">Display latest tweets and support tips on the WordPress Dashboard.</span>
    	</p>
    	
    	<p>
    		<input type="hidden" name="file_locking" value="0"<?php if (! $can_empty_file): ?> disabled="disabled"<?php endif; ?> />
    		<label><input type="checkbox" name="file_locking" value="1"<?php checked($file_locking, true); ?><?php if (! $can_empty_file): ?> disabled="disabled"<?php endif; ?> /> Enable file locking</label>
    		<br /><span class="description">Not recommended for network-based file systems.</span>
    	</p>

        <p class="submit">
        	<input type="submit" name="options_save" class="button-primary" value="Save changes" />
        </p>
	</fieldset>
</form>

<form action="admin.php?page=<?php echo $this->_page; ?>" method="post" enctype="multipart/form-data">
    <fieldset>
    	<legend>Import / Export Settings</legend>

        <table class="form-table">
            <tr>
    			<th>Import configuration:</th>
            	<td>
            		<input type="file" name="config_file" />
		        	<input type="submit" name="config_import" class="button" value="Upload" />
					<br /><span class="description">Upload and replace the settings file on the server.</span>
            	</td>
            </tr>
            <tr>
    			<th>Export configuration:</th>
            	<td>
		        	<input type="submit" name="config_export" class="button" value="Download" />
					<br /><span class="description">Download the settings file from the server.</span>
            	</td>
            </tr>
            <tr>
    			<th>Reset configuration:</th>
            	<td>
		        	<input type="submit" name="config_reset" class="button" value="Restore Default Settings" />
					<br /><span class="description">Revert all settings to the defaults. Any settings staged in preview mode will not be modified.</span>
            	</td>
            </tr>
		</table>
	</fieldset>
</form>

<?php include W3TC_DIR . '/inc/options/common/footer.phtml'; ?>